<template>
  <div>
    <el-container>
      <el-main>
        <el-container class="parent-body">
          <el-header class="content-header">
            <div>会员增长情况</div>
            <div>
              <el-button @click="exportOrder">导出数据</el-button>
              <el-select v-model="value3" class="margin-left input-width2">
                <el-option value="按月统计">按月统计</el-option>
                <el-option value="按年统计">按年统计</el-option>
              </el-select>
              <el-date-picker class="margin-left input-width2"
                              v-model="value4"
                              placeholder="请选择日期"
                              type="date">
              </el-date-picker>
            </div>
          </el-header>
          <el-main class="info-main padding-style">
            <div id="orderSC02" style="width:900px;height: 400px;margin: 10px auto;"></div>
          </el-main>
        </el-container>
      </el-main>
      <el-main>
        <el-container class="parent-body">
          <el-header class="content-header">
            <div>会员端口来源</div>
            <div>
              <el-button @click="exportOrder">导出数据</el-button>
              <el-select v-model="value2" class="margin-left input-width2">
                  <el-option value="按月统计">按月统计</el-option>
                  <el-option value="按年统计">按年统计</el-option>
              </el-select>
              <el-date-picker class="margin-left input-width2"
                              v-model="value1"
                              placeholder="请选择日期"
                              type="date">
              </el-date-picker>
            </div>
          </el-header>
          <el-main class="info-main padding-style">
            <div id="orderSC" style="width:500px;height: 400px;margin: 10px auto;"></div>
          </el-main>
        </el-container>
      </el-main>
      <el-footer>
        <el-container class="parent-body">
          <el-header class="content-header">
            <div>会员消费金额分布</div>
            <div>
              <el-button @click="exportOrder">导出数据</el-button>
              <el-select v-model="value5" class="margin-left input-width2">
                  <el-option value="按月统计">按月统计</el-option>
                  <el-option value="按年统计">按年统计</el-option>
              </el-select>
              <el-date-picker class="margin-left input-width2"
                              v-model="value6"
                              placeholder="请选择日期"
                              type="date">
              </el-date-picker>
            </div>
          </el-header>
          <el-main class="info-main padding-style">
            <div id="orderSC03" style="width:900px;height: 400px;margin: 10px auto;"></div>
          </el-main>
        </el-container>
      </el-footer>
    </el-container>

  </div>
</template>

<script>
    export default {
        data() {
            return {
                value1: '',
                value2: '按月统计',
                value4: '',
                value3: '按月统计',
                value6: '',
                value5: '按月统计',
                showData:[
                    ['APP', 41.1],
                    ['微信端', 86.5,],
                    ['PC端', 24.1],
                    ['小程序端', 55.2],
                    ['其他', 55.2]
                ],
                data01:[
                    '2019-07-01',
                    '2019-07-04',
                    '2019-07-07',
                    '2019-07-11',
                    '2019-07-15',
                    '2019-07-19',
                    '2019-07-22',
                    '2019-07-25',
                    '2019-07-28',
                    '2019-07-31'
                ],
                data02:[
                    0,
                    2,
                    2,
                    6,
                    6,
                    4,
                    5,
                    6,
                    1,
                    0
                ],
                data03:['0-50元', '51-100元', '101-200元', '201-500元', '501-1000元', '1001-5000元', '5001-10000元', '10001元以上'],
                data04:[7,3,3,6,6,3,2,3]
            }
        },
        methods:{
            exportOrder(){

            },
            OrderChart() {
                let myChart = this.$echarts.init(document.getElementById("orderSC"))
                var option = {
                    legend: {
                        right: 'right',
                    },
                    tooltip: {},
                    dataset: {
                        source: this.showData
                    },
                    series: [{
                        type: 'pie',
                        radius: '55%',
                        center: ['50%', '50%']
                    }]
                };
                myChart.setOption(option)
            },
            OrderChart01() {
                let myChart = this.$echarts.init(document.getElementById("orderSC02"))
                var option = {
                    color: ['#68BFB7'],
                    title: {
                        text: '新增会员数',
                        left: 'center',
                        bottom:'bottom'
                    },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data: this.data01
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        data: this.data02,
                        type: 'line'
                    }],
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '10%',
                        containLabel: true
                    }
                };
                myChart.setOption(option)
            },
            OrderChart02() {
                let myChart = this.$echarts.init(document.getElementById("orderSC03"))
                var option = {
                    color: ['#FF7878'],
                    xAxis: {
                        type: 'category',
                        data: this.data03,
                        axisTick: {
                            alignWithLabel: true
                        }
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        data: this.data04,
                        type: 'bar',
                        barWidth: '50%',
                    }],
                    grid: {
                        left: '0%',
                        right: '0%',
                        bottom: '3%',
                        containLabel: true
                    }
                };
                myChart.setOption(option)
            },
        },
        mounted() {
            this.OrderChart(),this.OrderChart01(),this.OrderChart02()
        }
    }
</script>

<style scoped>
  .badges {
    height: 60px;
    padding: 10px;
  }
  .common-home,.content-header{
    border-bottom:1px solid #E4E4E4;
    position: relative;
  }
  .common-home>div{
    display: inline-block;
    width:100px;
    height:50px;
    vertical-align: top;
    text-align: center;
    line-height: 50px;
    color:#666666;
  }
  .common-home>.refresh{
    position: absolute;
    right:10px;
  }
  .common-home>div>span{
    border:4px solid #0399FE;
    display: inline-block;
    width: 0px;
    height: 15px;
    vertical-align: middle;
    margin-right: 5px;
    background-color: #0399FE;
  }
  .parent-body{
    border:1px solid #E4E4E4;
  }
  .content-header{
    height:50px;
    line-height: 50px;
    background-color:#F3F3F3;
    color:#666666;
    position: relative;
    text-align: left;
  }
  .info-main{
    background-color:#fff;
  }

  .content-header>div{
    display: inline-block;
  }
  .content-header>div:last-of-type{
    position: absolute;
    right:10px;
  }
  .input-width{
    width:200px;
  }
  .select-div{
    display: inline-block;
    width:300px;
  }
  .input-width2{
    width:140px;
  }
  .input-width3{
    width:400px;
  }
  .padding-style{
    padding:0 !important;
  }

  .info-foot{
    background-color:#FDFDFE;
    height:60px;
    line-height: 60px;
    position: relative;
  }
  .paging-style{
    position: absolute;
    right:10px;
    display: inline-block;
    top:15px;
  }
  .margin-left{
    margin-left:10px;
  }
  .search-style{
    width:50%;
    display: inline-block;
    vertical-align: top;
  }
</style>

